package com.cjf.weather.weathercity.controller;

import com.cjf.weather.weathercity.service.CityDataService;
import com.cjf.weather.weathercity.vo.City;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author cjf
 * @description
 * @create 2019-03-30 19:25
 */
@RestController
@RequestMapping("/cities")
public class CityController {

    @Autowired
    private CityDataService cityDataService;

    @GetMapping("/listCity")
    public List<City> listCity() {
        List<City> cityList = null;
        try {
            cityList = cityDataService.listCity();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return cityList;
    }
}
